{extend name='admin@main'}

{block name="button"}

{if auth("add")}
<button data-open='{:url("add")}' data-title="增加" class='layui-btn layui-btn-sm layui-btn-warm'>新增资产</button>

{/if}

{if auth("state")}
<!-- <button data-action='{:url("state")}' data-rule="id#{key}" data-csrf="{:systoken('state')}" data-confirm="确定要强制办结吗？" class='layui-btn layui-btn-sm layui-btn-primary'>强制办结</button>
 -->{/if}

{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='device/index_search'}
    <table class="layui-table" lay-skin="switch">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap'>资产名称</th>
            <th class='text-left nowrap'>使用人</th>
            <th class='text-left nowrap'>所在位置</th>
			
			<th class='text-left nowrap'>购买时间</th>
			<th class='text-left nowrap'>数量</th>
            <th class='text-center nowrap'>当前状态</th>

            <th class='text-left nowrap'>操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
            </td>
            <td class='list-table-sort-td'>
                <label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.id}" class="list-sort-input"></label>
            </td>
            <td class='text-left nowrap'><a data-dbclick data-open="{:url("edit")}?id={$vo.id}" title="{$vo.devicename}">
			{$vo.devicename|default=''}</a></td>
			
            <td class='text-left nowrap'>{$vo.username|default='-'}</td>
            <td class='text-left nowrap'>{$vo.localtion|default='-'}</td>
			<td class='text-left nowrap'>{$vo.buytime|default='-'}</td>
			<td class='text-left nowrap'>{$vo.numbers|default='1'}</td>
            <td class='text-center nowrap'>
                
				{eq name='vo.status' value='完好'}<span class="color-green">完好</span>{/eq}
				{eq name='vo.status' value='损坏'}<span class="color-red">损坏</span>{/eq}
				{eq name='vo.status' value='待修'}<span class="color-orange">待修</span>{/eq}
				{eq name='vo.status' value='修理中'}<span class="color-orange">修理中</span>{/eq}
				{eq name='vo.status' value='报废'}<span class="color-black">报废</span>{/eq}
				{eq name='vo.status' value='遗失'}<span class="color-gray">遗失</span>{/eq}
            </td>

            <td class='text-left nowrap'>

                {if auth("edit") }
                <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑" data-open='{:url("edit")}?id={$vo.id}'>编辑</a>
                {/if}


				
                <div class="dropdown-menu">
                    <button class="layui-btn icon-btn layui-btn-sm layui-btn-danger">
                        &nbsp;维修 <i class="layui-icon layui-icon-drop"></i>
                    </button>
                    <ul class="dropdown-menu-nav">
						{if auth("repair") }
                        <li>
						<a class="layui-btn-warm" data-modal="{:url('repair')}?id={$vo.id}" data-value="id#{$vo.id}" data-csrf="{:systoken('state')}">添加维修</a>
						{/if}
						</li>
                        <li>
						
						<a class="layui-btn-green" data-modal="{:url('record')}?id={$vo.id}" data-value="id#{$vo.id}" data-csrf="{:systoken('state')}" area="800,720" title="{$vo.devicename|default=''}维修记录">维修记录</a>
						
						</li>

                    </ul>
                </div>

				
				

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>

{/block}
{block name='script'}
<script>
    layui.use(['layer', 'dropdown', 'element'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var dropdown = layui.dropdown;
        var element = layui.element;

    });
</script>
{/block}
